package com.yanghui.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class NavController {

    @RequestMapping("/{nav}")
    public String returnToJsp(@PathVariable(value = "nav") String nav) {
        String result = "page/" + nav;

        return result;
    }

    /**
     * 按照关键字搜索博客
     */
    @RequestMapping("/result")
    public String searResult(String keyword, Model model) {

        if (keyword != null) {
            model.addAttribute("keyword", keyword);
        }

        return "/page/result";
    }
}
